package edu.pw.p2pclient;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.preference.PreferenceManager;
import edu.pw.p2pclient.activities.SettingsActivity;
import edu.pw.p2pclient.networking.CommunicationService;

public class P2PBroadcastReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {

		if (PreferenceManager.getDefaultSharedPreferences(
				context.getApplicationContext()).getBoolean(
				SettingsActivity.AUTOSTART_PREF, false))
			context.startService(new Intent(context.getApplicationContext(),
					CommunicationService.class));
	}
}